
<!DOCTYPE HTML>
<html lang="" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>样式&主题 · GitBook</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        
        
        
    
    <link rel="stylesheet" href="gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="LAYOUT.html" />
    
    
    <link rel="prev" href="MOCK.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="./">
            
                <a href="./">
            
                    
                    简介
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="START.html">
            
                <a href="START.html">
            
                    
                    快速开始
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="MENU.html">
            
                <a href="MENU.html">
            
                    
                    菜单配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="PAGE.html">
            
                <a href="PAGE.html">
            
                    
                    页面开发
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="ROUTE.html">
            
                <a href="ROUTE.html">
            
                    
                    系统路由
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="AJAX.html">
            
                <a href="AJAX.html">
            
                    
                    Ajax请求
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="MOCK.html">
            
                <a href="MOCK.html">
            
                    
                    Mock模拟数据
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.8" data-path="STYLE.html">
            
                <a href="STYLE.html">
            
                    
                    样式&主题
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.9" data-path="LAYOUT.html">
            
                <a href="LAYOUT.html">
            
                    
                    导航布局
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.10" data-path="MODEL.html">
            
                <a href="MODEL.html">
            
                    
                    Model(Redux)
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.11" data-path="I18N.html">
            
                <a href="I18N.html">
            
                    
                    国际化
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.12" data-path="PERMISSION.html">
            
                <a href="PERMISSION.html">
            
                    
                    权限控制
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.13" data-path="NGINX.html">
            
                <a href="NGINX.html">
            
                    
                    Nginx配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.14" data-path="PROXY.html">
            
                <a href="PROXY.html">
            
                    
                    开发代理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.15" data-path="OTHER.html">
            
                <a href="OTHER.html">
            
                    
                    其他
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            Published with GitBook
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href="." >样式&主题</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x6837;&#x5F0F;">&#x6837;&#x5F0F;</h1>
<p>&#x7CFB;&#x7EDF;&#x4F7F;&#x7528;<a href="http://lesscss.org/" target="_blank">less</a>&#x8FDB;&#x884C;&#x6837;&#x5F0F;&#x7684;&#x7F16;&#x5199;&#x3002;</p>
<h2 id="css-&#x6A21;&#x5757;&#x5316;">css &#x6A21;&#x5757;&#x5316;</h2>
<p>&#x4E3A;&#x4E86;&#x907F;&#x514D;&#x591A;&#x4EBA;&#x5408;&#x4F5C;&#x6837;&#x5F0F;&#x51B2;&#x7A81;&#xFF0C;&#x7CFB;&#x7EDF;&#x5BF9;src&#x4E0B;&#x7684;less&#x6587;&#x4EF6;&#x542F;&#x7528;&#x4E86;Css Module&#xFF0C;css&#x6587;&#x4EF6;&#x6CA1;&#x6709;&#x4F7F;&#x7528;Css Module&#x3002;</p>
<p><a href="https://github.com/css-modules/css-modules" target="_blank">Css Module</a>&#x914D;&#x5408;<a href="https://github.com/gajus/react-css-modules" target="_blank">react-css-modules</a>&#x4F7F;&#x7528;&#xFF1A;</p>
<p>style.less</p>
<pre><code class="lang-less"><span class="hljs-selector-class">.root</span>{
    <span class="hljs-attribute">width</span>: <span class="hljs-number">100%</span>;
    <span class="hljs-attribute">height</span>: <span class="hljs-number">100%</span>;
}
</code></pre>
<p>Some.jsx</p>
<pre><code class="lang-jsx"><span class="hljs-keyword">import</span> <span class="hljs-string">&apos;/path/to/style.less&apos;</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">Some</span> <span class="hljs-keyword">extends</span> <span class="hljs-title">React</span>.<span class="hljs-title">Component</span> </span>{
    render() {
        <span class="hljs-keyword">return</span> (
            <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span> <span class="hljs-attr">styleName</span>=<span class="hljs-string">&quot;root&quot;</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>            
        );
    }
}
</code></pre>
<p>&#x6CE8;&#xFF1A;src/library&#x4E2D;less&#x6CA1;&#x6709;&#x542F;&#x7528;Css Module&#xFF0C;&#x57FA;&#x7840;&#x7EC4;&#x4EF6;&#x4E0D;&#x4F7F;&#x7528;Css Module&#xFF0C;&#x4E0D;&#x5229;&#x4E8E;&#x6837;&#x5F0F;&#x8986;&#x76D6;&#xFF1B;</p>
<h2 id="&#x4E3B;&#x9898;">&#x4E3B;&#x9898;</h2>
<p>&#x4F7F;&#x7528;less&#xFF0C;&#x901A;&#x8FC7;&#x6837;&#x5F0F;&#x8986;&#x76D6;&#x6765;&#x5B9E;&#x73B0;&#x3002;</p>
<h3 id="&#x7F16;&#x5199;&#x4E3B;&#x9898;">&#x7F16;&#x5199;&#x4E3B;&#x9898;</h3>
<ul>
<li>less&#x6587;&#x4EF6;&#x4E2D;&#x4F7F;&#x7528;&#x4E3B;&#x9898;&#x76F8;&#x5173;&#x53D8;&#x91CF;&#xFF1B;</li>
<li>&#x7F16;&#x5199;<code>/src/theme.js</code>&#x901A;&#x8FC7;<a href="https://github.com/webpack-contrib/less-loader" target="_blank">less-loader</a>&#x7684;<code>modifyVars</code>&#x8986;&#x76D6;less&#x4E2D;&#x7684;&#x53D8;&#x91CF;&#xFF1B;</li>
<li>&#x81EA;&#x5B9A;&#x4E49;&#x7684;&#x989C;&#x8272;&#x5143;&#x7D20;&#xFF0C;&#x5982;&#x679C;&#x53C2;&#x4E0E;&#x4E3B;&#x9898;&#xFF0C;&#x4E0D;&#x80FD;&#x4F7F;&#x7528;Css Module&#xFF08;&#x65E0;&#x6CD5;&#x6837;&#x5F0F;&#x8986;&#x76D6;&#xFF09;&#xFF0C;&#x540C;&#x65F6;&#x9700;&#x8981;&#x4FEE;&#x6539;<code>/public/color.less</code>&#xFF1B;</li>
</ul>
<p>&#x6CE8;&#xFF1A;&#x76EE;&#x524D;&#x6BCF;&#x6B21;&#x4FEE;&#x6539;&#x4E86;theme.js &#x9700;&#x8981;&#x91CD;&#x65B0;yarn start &#x624D;&#x80FD;&#x751F;&#x6548;</p>
<h3 id="&#x53C2;&#x8003;">&#x53C2;&#x8003;</h3>
<ul>
<li>Ant Design &#x4E3B;&#x9898; &#x53C2;&#x8003;&#xFF1A;<a href="https://ant-design.gitee.io/docs/react/customize-theme-cn" target="_blank">https://ant-design.gitee.io/docs/react/customize-theme-cn</a></li>
<li><code>/public/color.less</code> &#x6765;&#x81EA;&#x4E8E; <a href="https://ant-design.gitee.io/color.less" target="_blank">https://ant-design.gitee.io/color.less</a> &#xFF08;&#x7ECF;&#x8FC7;&#x6574;&#x7406;&#xFF09;  </li>
</ul>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="MOCK.html" class="navigation navigation-prev " aria-label="Previous page: Mock模拟数据">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="LAYOUT.html" class="navigation navigation-next " aria-label="Next page: 导航布局">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"样式&主题","level":"1.8","depth":1,"next":{"title":"导航布局","level":"1.9","depth":1,"path":"LAYOUT.md","ref":"LAYOUT.md","articles":[]},"previous":{"title":"Mock模拟数据","level":"1.7","depth":1,"path":"MOCK.md","ref":"MOCK.md","articles":[]},"dir":"ltr"},"config":{"gitbook":"*","theme":"default","variables":{},"plugins":[],"pluginsConfig":{"highlight":{},"search":{},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"fontsettings":{"theme":"white","family":"sans","size":2},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"}},"file":{"path":"STYLE.md","mtime":"2019-02-11T08:08:33.023Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2019-02-15T08:21:50.487Z"},"basePath":".","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="gitbook/gitbook.js"></script>
    <script src="gitbook/theme.js"></script>
    
        
        <script src="gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-sharing/buttons.js"></script>
        
    
        
        <script src="gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

